#!/usr/bin/env python
# -*- coding: utf-8 -*-

import logging
from config import settings
from logging import handlers


def get_logging():
    file_handler = handlers.TimedRotatingFileHandler(
        filename=settings.LOG_FILE_PATH,
        when=settings.LOG_WHEN,
        interval=settings.LOG_INTERVAL,
        encoding='utf-8'
    )
    logging.basicConfig(
        format='%(asctime)s - %(name)s - %(levelname)s -%(module)s:  %(message)s',
        datefmt='%Y-%m-%d %H:%M:%S %p',
        handlers=[file_handler],
        level=logging.DEBUG
    )
    return logging

logger = get_logging()

logger.debug('123')